<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:include  page="../common/file.jsp"/>
<head>
</head>
<body class="dialog_body">
<form id="submit_form" action="${pageContext.request.contextPath}/role/insert" method="post" target="_parent">
<div class="dialog-two-div">
	<table class="dialog-two-table">
		<tr>
			<td class="dialog-td-right">角色名称</td>
			<td class="dialog-td-left">
				<input type="text" id="roleName" name="roleName" maxlength="20" placeholder="请输入角色名称" validate="not-null,special-char"/>
				<span class="redtext">*</span>
				<div style="clear:both;display:none"></div>
				<span id="sameRoleName" style="margin-left:0px"></span>
			</td>
		</tr>
		<tr>
			<td class="dialog-td-right">序列</td>
			<td class="dialog-td-left">
				<input type="text" id="orderNo" name="orderNo" maxlength="3" placeholder="请输入序列" validate="not-null,pos-int-no0"/>
				<span class="redtext">*</span>
				<div style="clear:both;display:none"></div>
				<span id="sameOrderNo" style="margin-left:0px"></span>
			</td>
		</tr>
		<tr>
			<td class="dialog-td-right">描述</td>
			<td class="dialog-td-left">
				<textarea id="remark" name="remark" rows="3" style="width:200px" maxlength="255"></textarea>
			</td>
		</tr>
	</table>
	<table class="dialog-two-table dialog-table-submit">
		<tr class="dialog-two-button">
			<td colspan=4 >
				<button type="button" class="btn btn-warning submit-btn">提 交</button>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<button type="button" class="btn btn-default cancel-btn" target="_self">返 回</button>
			</td>
		</tr>
	</table>
</div>
</form>
<script type="text/javascript">
	
	//角色名称同名检测
	$('#roleName').bind('input propertychange', function() {
		var ctxt = "${pageContext.request.contextPath}";
		var roleName = $('#roleName').val();
		$.post(ctxt + "/role/sameCheckRoleName", {"roleName": roleName}, function(msg) {
			if (msg != undefined && msg.status == "1") {
				//$('#sameRoleName').html("<input style='border:0px;background-color:#e4e7e7;color:#ff8000;' type='text' readonly='readonly' value='已有相同的角色名称！' class='sameRoleName' />");
				$('#sameRoleName').html("<font style='float:left' color='red'>已有相同的角色名称！</font>");
				$('.submit-btn').hide();
			} else {
				$('#sameRoleName').html("");
				$('.submit-btn').show();
			}
		}, "json");
	});
	
	//提交保存
	function submitForm() {
		
		$(".submit-btn").unbind("click");
		$('#submit_form').submit();
		
		return true;
	}
	
	//关闭窗口
	$('.cancel-btn').click(function() {
		art.dialog.close();
	});

	//下拉框初始化图形
	$(".chosen-select").chosen({disable_search_threshold: 10});
</script>
</body>

  
